<?php
try{
	include 'core/Init.php';
	define('N_USER','Y');
	$n = new Controller();
	n_api("passport")->startSession();
	//$d = n_api("debug")->set('dev');	//[0:dev,1:test,2:alpha,3:beta,4:public]

	// $noLogin = ["open","error","install","pythonscrapy", "article", "mprank", "compete"];
	$noLogin = ["index","open","error","install","pythonscrapy", "article", "mprank", "compete", "weixin", "page","common","cart"];
	if(!in_array(N_EVENT, $noLogin) && N_SCRIPT!='cli'){
		//api("manager")->reloadPrivate();
		if(!in_array(N_EVENT,array("index")) && !in_array(N_ACTION, array("login","dologin","vcode","wapVcode","reg","doreg")) && n_api("passport")->isLogin() == false){

			n_go(n_url('passport','login'));
			exit();
		}
		//api("manager")->reloadPrivate();
	}




	$n->run();

	
}catch(CException $c){
	n_fault($c);

}catch(PException $p){
	n_alert($p);

}catch(exception $e){
	n_ufo($e);

}


n_debug();
